package rsj.sql.account;

import com.rlyy.aibase.utils.base.Node;
import com.rlyy.aibase.utils.base.TableNode;
import rsj.annotation.DynamicSelect;
import rsj.annotation.Param;
import rsj.annotation.Update;
import rsj.api.account.entity.AccountStatus;
import rsj.service.account.dynamic.AccountDynamicStatement;

/**
 * 账号
 *
 * @author yuanqinglong
 * @since 2021/7/15 15:43
 */
public interface AccountDao {


    /**
     * 账户列表
     *
     * @param customerName 客户名称
     * @param custId       客户编号
     * @param accountKey   账户关键
     * @param pageSize     页面大小
     * @param pageNow      页面现在
     * @return {@link TableNode}
     */
    @DynamicSelect(type = AccountDynamicStatement.class, method = "accountDynamicList")
    TableNode accountList(@Param(value = "customerName") String customerName, @Param(value = "custId") String custId,
                          @Param(value = "accountKey") String accountKey, @Param(value = "pageSize") Integer pageSize,
                          @Param(value = "pageNow") Integer pageNow);


    /**
     * 账户数
     *
     * @param customerName 客户名称
     * @param custId       客户编号
     * @param accountKey   账户关键
     * @return {@link TableNode}
     */
    @DynamicSelect(type = AccountDynamicStatement.class, method = "accountDynamicCount")
    Node accountCount(@Param(value = "customerName") String customerName, @Param(value = "custId") String custId,
                      @Param(value = "accountKey") String accountKey);


    /**
     * 更新帐户状态
     *
     * @param accountStatus 帐户状态
     */
    @Update(value = "UPDATE sys.sys_user SET user_status = #{status} WHERE user_org_id = #{orgId}")
    void updateAccountStatus(AccountStatus accountStatus);


}
